<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <com-btn></com-btn>
    <button-btn></button-btn>
  </div>
  <script src="../vue.js"></script>
  <script>
    const ButtonBtn = {
      template: 
      `
        <div>
          我是全局组件
          <btn></btn>
        </div>
      `,
      //局部组件定义在全局组件中
      components: {
        Btn: {
          template: 
          `
            <button>我是子组件</button>
          `,
        }
      }
    }
    Vue.component('ButtonBtn',ButtonBtn);
    const app = new Vue({
      el :'#app',
      //局部组件也可以在app实例中配置
      components: {
        ComBtn: {
          template: 
          `
            <button>我是子组件</button>
          `,
        }
      }
    })
  </script>
</body>
</html>